xen/arm: acpi: The fixmap area should always be cleared during failure/unmap
authorJulien Grall <jgrall@amazon.com>
Sat, 26 Sep 2020 18:53:27 +0000 (19:53 +0100)
committerMaximilian Engelhardt <maxi@daemonizer.de>
Thu, 23 Mar 2023 19:40:49 +0000 (19:40 +0000)
commit025f0ed6b0401a978d6a63b3a05279608b1a8957
treefba30f922d02e4baaba053bcea1456ab2df9c153
parent81fe4201835ac362b0fcc227eb1125e1ab138130
xen/arm: acpi: The fixmap area should always be cleared during failure/unmap

Commit 022387ee1ad3 "xen/arm: mm: Don't open-code Xen PT update in
{set, clear}_fixmap()" enforced that each set_fixmap() should be
paired with a clear_fixmap(). Any failure to follow the model would
result to a platform crash.

Unfortunately, the use of fixmap in the ACPI code was overlooked as it
is calling set_fixmap() but not clear_fixmap().

The function __acpi_os_map_table() is reworked so:
    - We know before the mapping whether the fixmap region is big
    enough for the mapping.
    - It will fail if the fixmap is already in use. This is not a
    change of behavior but clarifying the current expectation to avoid
    hitting a BUG().

The function __acpi_os_unmap_table() will now call clear_fixmap().

Reported-by: Wei Xu <xuwei5@hisilicon.com>
Signed-off-by: Julien Grall <jgrall@amazon.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
(cherry picked from commit 4d625ff3c3a939dc270b03654337568c30c5ab6e)

Gbp-Pq: Name 0031-xen-arm-acpi-The-fixmap-area-should-always-be-cleare.patch
xen/arch/arm/acpi/lib.c